package cn.mifengkong.appcommon.webview.listener;

import android.support.annotation.NonNull;

import com.mifengkong.frtools.jsbridge.CallBackFunction;

import org.json.JSONObject;

import cn.mifengkong.appcommon.util.StartActivityResultListener;
import cn.mifengkong.appcommon.webview.InfoToJsonUtil;

/**
 * Created by jiangyongxing on 2018/6/28.
 * 描述：
 */

public class MyStartActivityResultForJsbridgeListener implements StartActivityResultListener {

    private CallBackFunction function;

    public MyStartActivityResultForJsbridgeListener(CallBackFunction function) {
        this.function = function;
    }

    @Override
    public void success() {
        InfoToJsonUtil.assemblyIntoJson(function, setData());
    }

    @Override
    public void failure() {
        InfoToJsonUtil.assemblyIntoFailureJson(function, setData());
    }

    @NonNull
    protected JSONObject setData() {
        JSONObject date = new JSONObject();
        return date;
    }
}
